426B - Sereja and Mirroring - CodeForces Solution


implementation *1300

Please click on ads to support us..

Python Code:

n,m=map(int,input().split())
l=[]
for i in range(n):
    l.append(list(input()))
if n % 2 != 0:
    print(n)
else:
    start=n
    mid = n//2
    while start != 1:
        if l[0:mid][::-1] == l[mid:start]:
            start//=2
            mid=start//2
        else:
            break
    print(start)


Comments

Submit
0 Comments
More Questions

Teddy and Tweety
Partitioning binary strings
Special sets
Smallest chosen word
Going to office
Color the boxes
Missing numbers
Maximum sum
13 Reasons Why
Friend's Relationship
Health of a person
Divisibility
A. Movement
Numbers in a matrix
Sequences
Split houses
Divisible
Three primes
Coprimes
Cost of balloons
One String No Trouble
Help Jarvis!
Lift queries
Goki and his breakup
Ali and Helping innocent people
Book of Potion making
Duration
Birthday Party
e-maze-in
Bricks Game